//
//  JLFMCollectionViewCell.m
//  项目三
//
//  Created by rimi on 15/10/10.
//  Copyright (c) 2015年 rimi. All rights reserved.
//

#import "JLFMCollectionViewCell.h"
@interface JLFMCollectionViewCell () {

    UIImageView *_imageView;
}
@property (strong, nonatomic) IBOutlet UILabel *titleLabel;
@property (strong, nonatomic) IBOutlet UILabel *secoundTitle;

@property (strong, nonatomic) IBOutlet UILabel *label1;
@property (strong, nonatomic) IBOutlet UILabel *label2;
@property (strong, nonatomic) IBOutlet UILabel *label3;
@property (strong, nonatomic) IBOutlet UILabel *label4;
@property (strong, nonatomic) IBOutlet UILabel *label5;

@end
@implementation JLFMCollectionViewCell

- (void)awakeFromNib {
    // Initialization code
}

- (IBAction)respondsToCompareBtn:(UIButton *)sender {
    if (!_imageView) {
        _imageView = [[UIImageView alloc] initWithFrame:DHFlexibleFrame(CGRectMake(CGRectGetMidX(sender.frame) - 70, CGRectGetMinY(sender.frame) - 90, 135, 85))];
    }
    _imageView.image = [UIImage imageNamed:@"已添加至对比栏"];
    CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.scale"];
    if (![self.subviews containsObject:_imageView]) {
        [self addSubview:_imageView];
    }
    
    // 动画选项设定
    animation.duration = 0.5; // 动画持续时间
    animation.repeatCount = 1; // 重复次数
    
    // 缩放倍数
    animation.fromValue = [NSNumber numberWithFloat:0.3]; // 开始时的倍率
    animation.toValue = [NSNumber numberWithFloat:1.0]; // 结束时的倍率
    
    // 添加动画
    [_imageView.layer addAnimation:animation forKey:@"scale-layer"];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [_imageView removeFromSuperview];
    });
}

@end
